package com.qf.controller;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 千峰教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@RestController
public class TestController {


    @RequiresPermissions(value = {"sys:user:add", "sys:user:update"}, logical = Logical.AND)
    @RequestMapping("/test")
    public String test(){
        System.out.println("拥有 用户添加和更新权限");
        return "success";
    }

    @RequiresPermissions(value = {"sys:menu:add", "sys:menu:update"}, logical = Logical.AND)
    @RequestMapping("/test3")
    public String test3(){
        System.out.println("拥有 菜单添加和更新权限");
        return "success";
    }


    @RequiresRoles(value = {"开发工程师"})
    @RequestMapping("/test1")
    public String test1(){
        System.out.println("拥有开发工程师角色");
        return "success";
    }

    @RequiresRoles(value = {"管理员"})
    @RequestMapping("/test2")
    public String test2(){
        System.out.println("拥有管理员角色");
        return "success";
    }
}